package sun.nan.test.matlab;

import matlabcontrol.MatlabConnectionException;
import matlabcontrol.MatlabInvocationException;
import matlabcontrol.MatlabProxy;
import matlabcontrol.MatlabProxyFactory;

public class HelloWorld {
    public static void main(String[] args) throws MatlabConnectionException,
            MatlabInvocationException {
        // Create a proxy, which we will use to control MATLAB
        MatlabProxyFactory factory = new MatlabProxyFactory();
        MatlabProxy proxy = factory.getProxy();

        // Display 'hello world' just like when using the demo
        proxy.eval("x=24");
        System.out.println(((double[]) proxy.getVariable("x"))[0]);
        // Disconnect the proxy from MATLAB
        proxy.disconnect();
    }
}
